(function () {
	let params = dealUrl(location.href);
	console.log(params);
	$.ajax({
		url: `http://chst.vip:1234/api/getproduct?productid=${params.productid}`,
	}).then((res) => {
		let data = res.result[0];
		$("nav a:eq(1)").html(params.title+'&gt;');
		$("nav a:eq(2)").html(data.productName);

		let str = `
        <div class="pic">
        ${data.productImg}
        </div>
        <div class="title">
           ${data.productName}
        </div>
        ${data.bjShop}
        `;
        $('.info').html(str)
	});

    $.ajax({
        url:`http://chst.vip:1234/api/getproductcom?productid=${params.productid}`
    }).then(res=>{
        let html=res.result.reduce((value,item)=>{
            return value+`
            <li>
            <div class="up">
                <span class="user">${item.comName}</span>
                <span class="time">${item.comTime}</span>
            </div>
            <p>
                ${item.comContent}
            </p>
            <div class="from">${item.comFrom}</div>
        </li>
            `
        },"")

        $('.comment .list').html(html)
    })

})();
